﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Common.Views;
using iTextSharp.text;

namespace BusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IOrdersService" in both code and config file together.
    /// <summary>
    /// This interface contains methods found in the OrdersService which send and get data regarding 
    /// orders to and from the Orders and OrderDetails tables in the database.
    /// </summary>
    [ServiceContract]
    public interface IOrdersService
    {
        /// <summary>
        /// A method used to create a new order for a particular user
        /// </summary>
        /// <param name="username">The username of the user placing the order</param>
        /// <param name="orderID">The ID of the order (GUID)</param>
        /// <param name="products">A list of the products bought</param>
        [OperationContract]
        void PlaceOrder(string username, Guid orderID, List<CartView> products);

        /// <summary>
        /// A method which retrieves a list of all the products bought by a particular user
        /// </summary>
        /// <param name="username">The username of the user for which to get the list of products</param>
        /// <returns>A list of the products bought by the particular username</returns>
        [OperationContract]
        IEnumerable<OrdersView> GetProductsBoughtByUser(string username);

        /// <summary>
        /// A method which gets the most purchased item
        /// </summary>
        /// <returns>A list of details of the most purchased item</returns>
        [OperationContract]
        IEnumerable<StatisticalView> MostPurchasedItem();

        /// <summary>
        /// A method which gets the highly rated item
        /// </summary>
        /// <returns>A list of details of the highly rated item</returns>
        [OperationContract]
        IEnumerable<StatisticalView> HighlyRatedItem();

        /// <summary>
        /// A list of products with the highest number of faults
        /// </summary>
        /// <returns>A list of the products with the highest number of faults and their details</returns>
        [OperationContract]
        IEnumerable<StatisticalView> HighestNumOfFaults();

        /// <summary>
        /// A list of products with the least number of faults
        /// </summary>
        /// <returns>A list of the products with the least number of faults and their details</returns>
        [OperationContract]
        IEnumerable<StatisticalView> LeastNumOfFaults();

        /// <summary>
        /// A method which is used to send the order details to a user
        /// </summary>
        /// <param name="username">The username of the user whom to send the order details</param>
        [OperationContract]
        void SaveDetails(string username);
    }
}
